proc addchan {nick otbn1 host handle} {
  global botnick home defchanoptions defchanmodes bcast

# Old Bot-Solutions code intended to  prevent use by Bot-Solutions competitiors 
# =============================================================================
#  if {($otbn1 == "#bothouse") && (![matchattr $handle n])} {
#    putquick "NOTICE $nick :Unable To Execute Command - Cannot add BService channel into channel partition - Permission Denied."
#
#    if {$bcast == "1"} {
#      putquick "PRIVMSG $home :\002$nick\002 ($host) tried to addchan #BotHouse in my channel partition - a restricted channel."
#    }
#
#  return 0
#  }

  if {$otbn1 == ""} {
    putquick "NOTICE $nick :\0034ERROR - Invaild Syntax - Should Be - (/msg) $botnick addchan <#channel>"
    return 0
  } elseif {[validchan $otbn1]} {
    putquick "NOTICE $nick :\0034ERROR - Channel Currently Exsists - The channel $otbn1 is currently in channel partition."
    return 0
  } elseif {[string match "#*" $otbn1]} {
    channel add $otbn1 $defchanmodes 
    putlog "!$nick ($host)! addchan $otbn1"
    putquick "NOTICE $nick :\0033Sucessfully added $botnick to $otbn1"

    if {$bcast == "1"} {
      putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to addchan \002$otbn1\002 into my channel partition."
    }

    # uh, why is this code here?  Wasn't this handled above with $defchanmodes?
    # Note: changed -aop to +aop for auto-op support
    channel set $otbn1 -clearbans +enforcebans -dynamicbans +userbans +autoop -bitch +greet -protectops +statuslog -stopnethack -revenge +autovoice -secret -shared +cycle 
    save
    return 0
  } else {
    # Invalid channel name...
    putquick "NOTICE $nick :\0034ERROR - Illegal Channel Name - Try adding a # in front of the name (eg. #overtech)"
    putquick "NOTICE $nick :\00312Note - This bot does not support local (channel names preceeded with a +) or Microsoft-style (channel names without a preceding character) chatrooms."
    return 0
  }
}









